res = 0
for i in range(1, 1001):
    res += pow(i, i, 10 ** 10)
print(res % (10 ** 10))
